package com.scraper.articles.web.service.impl;

import com.scraper.articles.web.dao.ArticleDao;
import com.scraper.articles.web.model.Article;
import com.scraper.articles.web.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

	@Autowired
	private ArticleDao articleDao;

	@Override
	@Transactional(readOnly = true)
	public List<Article> listArticles() {
		return articleDao.listArticles();
	}

	@Override
	@Transactional(readOnly = true)
	public Article getArticle(Long id) {
		return articleDao.getArticle(id);
	}

	@Override
	@Transactional(readOnly = true)
	public List<Article> listArticles(Long requestId) {
		return articleDao.listArticles(requestId);
	}

	@Override
	@Transactional
	public void deleteArticle(Long id) {
		articleDao.deleteArticle(id);
	}
}
